#pragma once

// include VSTGUI
#ifndef __vstgui__
#include "vstgui.sf/vstgui/vstgui.h"
#endif

#include "LGUIDesktop.h"
#include "LGUIMultiMeter.h"

//-----------------------------------------------------------------------------
class VstXEditor : public AEffGUIEditor, public CControlListener, public LGUIListener
{
public:
	VstXEditor (AudioEffect *effect);
	virtual ~VstXEditor ();

public:
	virtual bool open (void *ptr);
	virtual void close ();

	virtual void setParameter (VstInt32 index, float value);
	virtual void valueChanged (CDrawContext* context, CControl* control);
	virtual bool getRect(ERect **rect);

	virtual void onGUIMessage(const LGUIMessage &msg);

private:
    LGUIDesktop desktop;

	LGUIMultiMeter *voiceDisplay;
	LGUIMultiMeter *channelDisplay;
	LGUIMultiMeter *channelVu[16];
	LGUIMultiMeter *totalVu;

	HWND wnd;
	HMENU modulationSourceMenu;
	HMENU modulationDestMenu;

	BITMAPINFO *bitmap_header;
	void refreshKnobs();
	void refreshKnob(int param);
	void setCurChannel(int c);
	int curChannel;
	static int useCount;
	char bitmapbuffer[sizeof(BITMAPINFO)+16];
	static LRESULT CALLBACK  wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
};
